package uk.ac.manchester.tewpl.iceiface.client.explorer;

import java.util.ArrayList;
import java.util.Collection;

import uk.ac.manchester.tewpl.iceiface.client.explorer.nodes.Airport;
import uk.ac.manchester.tewpl.iceiface.client.model.KBIndividualModel;
import uk.ac.manchester.tewpl.iceiface.client.model.KBObjectPropertyModel;

public class AirportFilter {
	
	private Airport airport;
	private String filter;
	private ArrayList<FilterResult> results;
	
	public AirportFilter(Airport reqAirport, String reqFilter, ArrayList<FilterResult> res) {
		airport = reqAirport;
		filter = reqFilter;
		results = res;
	}
	
	public Airport getAirport() {
		return airport;
	}
	
	public String getFilter() {
		return filter;
	}
	
	public void setResults(ArrayList<FilterResult> res) {
		results = res;
	}
	
	public ArrayList<FilterResult> getResults() {
		return results;
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("Airport: " + airport.getLabel() + "<br>");
		sb.append("Filter: " + filter + "\nIndividuals:<br>");
		for (FilterResult result : results) { // For every result
			sb.append("<Individual>: " + result.getIndividual().getUri() + "<br>");
			sb.append("++ Object Properties (" + result.getProperties().size() + ")<br>");
			for (KBObjectPropertyModel property : result.getProperties().keySet()) { // For every object property
				sb.append(" > " + property.getLabel() + "<br>");
				for (KBIndividualModel propValue : result.getProperties().get(property)) { // For every property value
					sb.append(" >> " + propValue.getClasses().iterator().next().getLabel() + "<br>");
				}
			}
		}
		return sb.toString();
	}

	/*public java.util.Map<KBIndividualModel, java.util.Map<KBObjectPropertyModel, Collection<KBIndividualModel>>> getResults() {
		return results;
	}*/
	
}
